<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        let obj = {
            name:"张三",
            age:18,
            addr:"郑州"
        }
        console.log(obj.sex);
        

        // //属性
        // for (const item of Object.keys(obj)) {
        //     console.log(item)
        // }
        // //属性值
        // for (const item of Object.values(obj)) {
        //     console.log(item)
        // }
        // //键值对 属性——值
        // for (const [k,v] of Object.entries(obj)) {
        //     console.log(k,v)
        // }


        let obj2 = {
            name:"李四",
            //age:undefined,
            sex:"男"
        }
      let res = Object.assign(obj,obj2)
        console.log(obj)
        console.log(res)
    </script>
</head>
<body>
    
</body>
</html>